import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Main from './Main';
import '../../../style/Index.scss';

class ShopCategory extends Component {
  toRouter = (key) => {
    const { history } = this.props;

    switch (key) {
      case 'page1':
        history.push('/goodscategory/page1');
        break;
      case 'page2':
        history.push('/goodscategory/page2');
        break;
      default:
    }
  }

  static propTypes = {
    match: PropTypes.object.isRequired,
    location: PropTypes.object.isRequired,
    history: PropTypes.object.isRequired
  }

  render() {
    return (
      <div>商品分类
        <ul className="nav">
          <li onClick={() => this.toRouter('page1')}>概况</li>
          <li onClick={() => this.toRouter('page2')}>店铺</li>
          <li onClick={() => this.toRouter('goodsitem')}>商品</li>
        </ul>
        <Main />
      </div>
    )
  }
}

export default ShopCategory;
